<?php

class InputComponent extends BlueprintComponent {
	
	function parse(&$element, $value) {
		$doc = $element->document;
		
		$type = strtolower($element->attributes["type"]) or $type = 'text';
		if ($type == 'checkbox') {
			$element->code = "<?= $value ? ' checked' : '' ?>";
		} elseif ($type == "radio") {
			$element->code = "<?= $value == \"{$element->attributes['value']}\" ? ' checked' : '' ?>";
		} elseif ($type == "file") {
			
		} else {
			$element->attributes["value"] = "<?php echo $value ?>";
		}
	}
}
?>